<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            width: 200px;
            height: 200px;
            background-color: pink;
        }
    </style>
</head>

<body>
    <div></div>
    <script>
        var div = document.querySelector('div')
        var flag = 0
        div.onclick = function () {
            if (flag == 0) {
                this.style.backgroundColor = 'skyblue'
                this.style.width = '300px'
                flag = 1
            } else {
                this.style.backgroundColor = 'pink' 
                flag = 0
            }
        }
        //1.js里面的样式注意采取驼峰命名法 fontSize 
        // 2.js修改 style样式操作 产生的是行内样式css权重比较高（css行内样式 > css内嵌式样式）

    </script>
</body>

</html>